<template>
	<view class="content setPadding setFontColor1">
		<!-- <zero-loading v-if="loading" type="love" :mask="true"></zero-loading> -->
		<navigationBar :titleName="'搜索'"></navigationBar>
		<u-tabs :list="listTabs" @click="clickTabs" :current="typeFlag" lineColor="#19be6b" lineHeight="5"></u-tabs>
		<!-- 搜索框 -->

		<!-- 搜索公司 -->
		<view v-if="typeFlag==0" class="">
			<view class="search setVerticalCenter">
				<view class="setNowrap2">
					<searchIdael @allSearch="allSearch" :textTip2="textTip2" @textTipChange="textTipChange" @searchResult="searchResult" @moreKeyWord="moreKeyWord" :apiflag="'1'" :keyword2="keyword"></searchIdael>
				</view>
				<!-- <view  class="setDisplayCenter">
					<view class="">
						<u-button size="mini" @click="allSearch" type="success">全库搜索</u-button>
					</view>
				</view> -->
			</view>
			<u-loadmore v-if="status2=='loading'" height="100" fontSize="28" iconSize="28"
				:status="status2" />
			<!-- 搜索结果 -->
			<view class="setBasestyle ">
				
				<scrollslot v-if="allCompany.length>0" @refreshArr="refreshArr" :heightSure="'height: 84vh;'">
					<!-- <view :slot="'t1'" >
						共为您找到{{allSize}}条结果
					</view> -->
					<view :slot="'t2'">
						<company2 :showLastName="'1'" :companyList="allCompany"></company2>
						<u-loadmore v-if="allCompany.length>0" height="100" fontSize="28" iconSize="28"
							:status="status" />
					</view>

				</scrollslot>

				<view v-if="noExitData==1" class="setVerticalLayout  setPadding">

					<view class="">
						很抱歉没有找到合适的结果
					</view>
				


				</view>
				<view v-if="noExitData2==1" class="setDisplayCenter setPadding">
					<u-empty iconSize='120' textSize='30' mode="data">
					</u-empty>

				</view>
				
			</view>
			<!--  v-if="!allCompany.length"   v-if="showFlag1==1"-->
			<view v-if="!allCompany.length">
				<view class="">
					<view class="sethorizontalbetween setMarginTop " @click="clearAllTag()">
						<text>搜索历史</text>
						<text class="iconfont iconashbin "></text>
					</view>
					<view class=" setVerticalCenter setwarp">

						<view class="setMarginHorizontal " @click="searchRecord(item)"
							v-for="(item,index) in recordList" :key="index">
							<u-tag :text="item" type="success" size="mini" @click="searchRecord(item)" closable
								@close="closeTag(index)" plain></u-tag>
						</view>
					</view>
				</view>
				<view class="setMarginVertical setMarginTop" v-if="showFlag2==1">

					<view class="sethorizontalbetween">
						<text>浏览记录</text>
						<text @click="closeAll()" class="iconfont iconashbin "></text>
					</view>
					<view @click="searchRecord(item)" class="sethorizontalbetween setMarginVertical"
						v-for="(item,index) in recordCompanyList" :key="index">
						<text>{{item}}</text>
						<text @click.stop="closehistory(index)" class="iconfont iconclose"></text>
					</view>

				</view>
			</view>

		</view>
		<view v-else class="">
			<!--搜索-->
			<search :name="searchName" :keyword.sync="keyword" :history.sync="history" :showHistory.sync="showHistory"
				@confirm="search" @focus="initSearch"></search>

			<view class="content" v-if="!showHistory">
				<scrollslot v-if="list" @refreshArr="refreshArr">
					<!-- <view :slot="'t1'" >
						共为您找到{{allSize}}条结果
					</view> -->
					<view :slot="'t2'">
						<articleList :list="list" :word="keyword" />

						<!-- <noData v-if="showNoData" text="暂无相关信息~"></noData> -->
						<u-loadmore  height="100" fontSize="28" iconSize="28" :status="status" />

					</view>
				</scrollslot>

			</view>

		</view>



	</view>
</template>

<script src="./findSearch.js"></script>

<style scoped lang="scss">
	page {
		// height: 100%;
		// // background-color: #f8f6f9;
		background-color: #fff;
		// opacity: 0;
		// transition: all .5s;
	}

	.page {
		display: flex;
		flex: 1;
		flex-direction: column;
		overflow: hidden;
		height: 100%;

	}

	.content {
		flex: 1;
		width: 100%;
		height: 100rpx;
	}

	/*头部*/
	.top {
		/*页面标题*/
		padding-bottom: 20rpx;

		.page-title {
			padding: 16rpx 0 6rpx;
			display: flex;
			justify-content: center;
			align-items: center;
			height: 90rpx;
			text-align: center;
			border-bottom: 1rpx solid #efefef;
			z-index: 9999;

			.back {
				flex-grow: 0;
				flex-shrink: 0;
				line-height: normal;
				padding-left: 30rpx;

				/deep/.icon {
					color: #c1c4c9;
					font-size: 36rpx;
				}
			}

			.logo {
				flex-grow: 1;
				flex-shrink: 1;
				line-height: normal;

				image {
					height: 50rpx;
					width: 280rpx;
					margin-left: -110rpx;
				}
			}
		}

		/* 顶部navbar */
		.navbar {
			position: relative;
			height: 80rpx;
			white-space: nowrap;
			z-index: 10;
			border-bottom: 1px solid #e8e8e8;

			.item {
				position: relative;
				display: inline-block;
				width: 150rpx;
				height: 80rpx;
				text-align: center;
				padding-top: 7rpx;
				line-height: 80rpx;

				&:after {
					content: '';
					width: 0;
					height: 0;
					position: absolute;
					left: 50%;
					bottom: 0;
					transform: translateX(-50%);
					transition: 0.3s;
				}

				.text {
					position: relative;
					width: auto;
					height: auto;
					line-height: auto;
					display: inline-block;

					text {
						font-size: 34rpx;
						color: #262626;
					}

					image {
						position: absolute;
						top: 16rpx;
						right: -14rpx;
						width: 50rpx;
						height: 50rpx;
						display: none;
					}
				}
			}

			.current {
				&:after {
					width: 50%;
				}

				.text {
					font-weight: bold;

					image {
						display: block;
					}
				}
			}
		}

		/*浮动navbar*/
		.floatbar {
			box-shadow: 0 8upx 8upx rgba(0, 0, 0, 0.06);
			border-bottom: 0;
		}
	}

	.scroll {
		// height: 900rpx;
		height: 100vh;
	}

	.scrolly {
		// height: 1000rpx;
		height: 100vh;
	}

	/*幻灯片广告 */
	.swiper {
		height: 320rpx;

		image {
			width: 97%;
			margin: 3.5% 1.5%;
			height: 260rpx;
			border-radius: 24rpx;
			transition: all 0.2s ease-in 0s;
		}

		.current {
			width: 97%;
			height: 300rpx;
			margin: 1.5% 1.5%;
			transition: all 0.2s ease-in 0s;
		}

		.title {
			position: absolute;
			bottom: 0;
			left: 0;
			width: 100%;
			background: rgba(0, 0, 0, 0.5);
			color: #fff;
			padding: 20rpx;
			white-space: nowrap;
			text-overflow: ellipsis;
			overflow: hidden;
			font-size: 11pt;
			display: none;
		}
	}

	/deep/ .navbar {
		display: none;
	}
</style>
